// pages/map/map.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    campus: 0,
    longitude: [103.989469, 104.304843],
    latitude: [30.580376, 30.605616],
    markers: [[{
      iconPath: "/assets/image/weizhi.png",
      id: 0,
      latitude: 30.581877,
      longitude: 103.985580,
      width: 30,
      height: 30,
      callout: {
        content: '体育公园',
        borderRadius: 5,
        padding: 10
      }
    },
    {
      iconPath: "/assets/image/weizhi.png",
      id: 2,
      latitude: 30.580496,
      longitude: 103.984990,
      width: 30,
      height: 30,
      callout: {
        content: '中心花园',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 3,
      latitude: 30.581706,
      longitude: 103.987162,
      width: 30,
      height: 30,
      callout: {
        content: '汇海',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 4,
      latitude: 30.580588,
      longitude: 103.987243,
      width: 30,
      height: 30,
      callout: {
        content: '钟楼',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 5,
      latitude: 30.581036,
      longitude: 103.987581,
      width: 30,
      height: 30,
      callout: {
        content: '梅香园',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 6,
      latitude: 30.581156,
      longitude: 103.988332,
      width: 30,
      height: 30,
      callout: {
        content: '桂花园',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 7,
      latitude: 30.582786,
      longitude: 103.990391,
      width: 30,
      height: 30,
      callout: {
        content: '小罗马广场',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 8,
      latitude: 30.582029,
      longitude: 103.986207,
      width: 30,
      height: 30,
      callout: {
        content: '银杏大道',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 9,
      latitude: 30.582736,
      longitude: 103.992017,
      width: 30,
      height: 30,
      callout: {
        content: '大气探测场',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 10,
      latitude: 30.584130,
      longitude: 103.985408,
      width: 30,
      height: 30,
      callout: {
        content: '情人坡',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 11,
      latitude: 30.584564,
      longitude: 103.987629,
      width: 30,
      height: 30,
      callout: {
        content: '国防生林',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 12,
      latitude: 30.584126,
      longitude: 103.990778,
      width: 30,
      height: 30,
      callout: {
        content: '国防生训练场',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 13,
      latitude: 30.579392,
      longitude: 103.989699,
      width: 30,
      height: 30,
      callout: {
        content: '南门',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 14,
      latitude: 30.579341,
      longitude: 103.984319,
      width: 30,
      height: 30,
      callout: {
        content: '西一门',
        borderRadius: 5,
        padding: 10
      }
    }
      ,
    {
      iconPath: "/assets/image/weizhi.png",
      id: 15,
      latitude: 30.581600,
      longitude: 103.983595,
      width: 30,
      height: 30,
      callout: {
        content: '西二门',
        borderRadius: 5,
        padding: 10
      }
    }
    ],
    //---------------龙泉标点-------------------------
      [{
        iconPath: "/assets/image/weizhi.png",
        id: 16,
        latitude: 30.606198,
        longitude: 104.307756,
        width: 30,
        height: 30,
        callout: {
          content: '体育馆',
          borderRadius: 5,
          padding: 10
        }
      },
      {
        iconPath: "/assets/image/weizhi.png",
        id: 17,
        latitude: 30.605644,
        longitude: 104.307482,
        width: 30,
        height: 30,
        callout: {
          content: '礼堂',
          borderRadius: 5,
          padding: 10
        }
      },
      {
        iconPath: "/assets/image/weizhi.png",
        id: 18,
        latitude: 30.604942,
        longitude: 104.305605,
        width: 30,
        height: 30,
        callout: {
          content: '东阳森林',
          borderRadius: 5,
          padding: 10
        }
      },
      {
        iconPath: "/assets/image/weizhi.png",
        id: 19,
        latitude: 30.605801,
        longitude: 104.305176,
        width: 30,
        height: 30,
        callout: {
          content: '九龙柱广场',
          borderRadius: 5,
          padding: 10
        }
      }]],
    //-------------------路线图（暂时放弃）---------------
    // polyline: [[{
    //   points: [
    //     //南门
    //     {
    //       longitude: 103.989812,
    //       latitude: 30.579360
    //     },
    //     // 南门内
    //     {
    //       longitude: 103.989726,
    //       latitude: 30.579572
    //     },
    //     // 南门内左
    //     {
    //       longitude: 103.989533,
    //       latitude: 30.579526
    //     },
    //     // 一食堂T字形路由
    //     {
    //       longitude: 103.985006,
    //       latitude: 30.579378
    //     },
    //     //西一门
    //     {
    //       longitude: 103.984051,
    //       latitude: 30.579277
    //     },
    //     // 一食堂T字形路由
    //     {
    //       longitude: 103.985006,
    //       latitude: 30.579378
    //     },
    //     //蜜雪冰城十字路口
    //     {
    //       longitude: 103.984963,
    //       latitude: 30.581826
    //     },
    //     // 西二门
    //     {
    //       longitude: 103.983654,
    //       latitude: 30.581613
    //     },
    //     //蜜雪冰城十字路口
    //     {
    //       longitude: 103.984963,
    //       latitude: 30.581826
    //     },
    //     //小罗马
    //     {
    //       longitude: 103.990241,
    //       latitude: 30.582722
    //     },
    //     //银杏大道->汇海
    //     {
    //       longitude: 103.986636,
    //       latitude: 30.582094
    //     },
    //     //汇海凉亭
    //     {
    //       longitude: 103.986636,
    //       latitude: 30.582108
    //     },
    //     //汇海
    //     {
    //       longitude: 103.987452,
    //       latitude: 30.581318
    //     },
    //     //汇海凉亭
    //     {
    //       longitude: 103.986787,
    //       latitude: 30.581780
    //     },
    //     //蜜雪冰城十字路口
    //     {
    //       longitude: 103.984963,
    //       latitude: 30.581826
    //     },
    //     //情人坡十字路口
    //     {
    //       longitude: 103.984931,
    //       latitude: 30.583821
    //     },
    //     //情人坡
    //     {
    //       longitude: 103.988997,
    //       latitude: 30.584532
    //     },
    //     //情人坡-》体育馆
    //     {
    //       longitude: 103.989930,
    //       latitude: 30.584430
    //     },
    //     //资环楼
    //     {
    //       longitude: 103.992205,
    //       latitude: 30.584735
    //     },
    //     //资环楼 拐角
    //     {
    //       longitude: 103.993079,
    //       latitude: 30.584176
    //     },
    //     //双中心广场
    //     {
    //       longitude: 103.993825,
    //       latitude: 30.581798
    //     },
    //     //行政楼-信息楼路口
    //     {
    //       longitude: 103.991867,
    //       latitude: 30.581184
    //     },
    //     //双中心-行政楼路口
    //     {
    //       longitude: 103.992301,
    //       latitude: 30.580394
    //     },
    //     // 南门内
    //     {
    //       longitude: 103.989726,
    //       latitude: 30.579572
    //     },
    //   ],
    //   color: "#B452CD",
    //   width: 5
    // }],[]]
  },
  callouttap(e) {
    // if (e.markerId == 14 || e.markerId == 15 || e.markerId == 13) return
    wx.navigateTo({
      url: '/pages/detail/detail?id=' + e.markerId
    })
  },
  chooseCampus(e) {
    if (e.currentTarget.dataset.campus == this.data.campus) {
      return
    }
    this.setData({
      campus: parseInt(e.currentTarget.dataset.campus)
    })
  }
})